package com.vito.framework.system.menu.service.impl;

import com.vito.framework.system.menu.model.MenuBean;

import java.util.ArrayList;
import java.util.List;

public class MenuTree {
    
    public static List<MenuBean> buildDivMenuTreeData(List<MenuBean> menuList){

		return getChildren(menuList,"01");
    }
    

	public static List<MenuBean> getChildren(List<MenuBean> menuList ,String parentid){
		
		List<MenuBean> children =new ArrayList<MenuBean>();
		for(MenuBean menu :menuList){
			if(menu.getParentMenu().equals(parentid)){
				menu.setChildren(getChildren(menuList, menu.getMenuId()));
				children.add(menu);
			}
		}
		return children;
	}

}
